package com.lyhengtongwl.zqsnews.net;

import android.app.Activity;

import com.lyhengtongwl.zqsnews.App;
import com.lyhengtongwl.zqsnews.entity.NewsBaseEntity;
import com.lyhengtongwl.zqsnews.utils.AppConfig;
import com.lyhengtongwl.zqsnews.utils.SPUtils;

import retrofit2.Response;

/**
 * 上传点击次数
 */
public class UpClickCount {
    private static UpClickCount instance;
    private Activity mContext;

    private UpClickCount(Activity context) {
        mContext = context;
    }

    public static UpClickCount getInstance(Activity activity) {
        if (instance == null) {
            synchronized (AppConfig.class) {
                if (instance == null) {
                    instance = new UpClickCount(activity);
                }
            }
        }
        return instance;
    }

    public void upClick(String title, String chineseTile) {
        String userId = SPUtils.get(App.getContext(), "userId", "") + "";
        Task.getApiService().upClickCount(userId, title, chineseTile).enqueue(new MyCallback<NewsBaseEntity>(mContext) {
            @Override
            protected void onSuccess(Response<NewsBaseEntity> response) {

            }

            @Override
            protected void onFailure(Throwable t) {

            }
        });
    }
}
